//
//  FFSJSONHighlightViewController.m
//  FFSurveillance
//
//  Created by roro_latrobe on 16/11/8.
//  Copyright © 2016年 cn.wanda. All rights reserved.
//

#import "FFSJSONHighlightViewController.h"

@interface FFSJSONHighlightViewController ()

@property (nonatomic, strong) UIScrollView *myScrollview;

@end

@implementation FFSJSONHighlightViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.myScrollview = [[UIScrollView alloc] initWithFrame:self.view.bounds];
    //    CGFloat textLength = [highlightView.text sizeWithFont:highlightView.font constrainedToSize:CGSizeMake(CGFLOAT_MAX, 50) lineBreakMode:NSLineBreakByCharWrapping].width;
    self.myScrollview.contentSize = CGSizeMake(1000, self.view.bounds.size.height);
    self.highlightView.frame = CGRectMake(self.highlightView.bounds.origin.x, self.highlightView.bounds.origin.y, 1000, self.view.bounds.size.height);
    [self.myScrollview addSubview:self.highlightView];
    [self.view addSubview:self.myScrollview];
    
//    _myScrollview.backgroundColor = [UIColor yellowColor];
//    highlightView.backgroundColor = [UIColor greenColor];
    // Do any additional setup after loading the view, typically from a nib.
    self.highlightView.showsHorizontalScrollIndicator = YES;
    self.highlightView.showsVerticalScrollIndicator = YES;
    _myScrollview.showsVerticalScrollIndicator = YES;
    _myScrollview.showsHorizontalScrollIndicator = YES;
    //    highlightView .frame = self.view.bounds;
    
    //    highlightView.contentSize = CGSizeMake(1000, self.view.bounds.size.height);
    // Overwrite the textColor from the nib, set to clearColor
    self.highlightView.textColor = [UIColor clearColor];
    
    self.highlightView.text = self.jsonStr;
    
    // Set the syntax highlighting to use (the tempalate file contains the default highlighting)
    [self.highlightView setHighlightDefinitionWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"objectivec" ofType:@"plist"]];
    // Set the color theme to use (all XCode themes are fully supported!)
    [self.highlightView setHighlightTheme:kRegexHighlightViewThemeBasic];
}

- (RegexHighlightView *)highlightView {
    if (!_highlightView) {
        _highlightView = [[RegexHighlightView alloc] initWithFrame:CGRectZero];
    }
    return _highlightView;
}

@end
